<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/10/10
 * Time: 10:56
 */

namespace app\admin\model;
use think\Model;
use think\Db;

class Car extends Model
{
    // 确定链接表名
    protected $name = 'guide_car';

    public function getCarList($where, $offset, $limit)
    {
        //查询所有的
        $res = $this->alias('a')
            ->field('a.*,u.name')
            ->join('guide u','a.guide_id=u.guide_id','left')
            ->where($where)->limit($offset, $limit)->order('a.car_id','desc')->select();

        return $res;
    }

    public function getCarCount($where)
    {
        //查询所有的
       return $this->alias('a')
            ->field('a.*,u.name')
            ->join('guide u','a.guide_id=u.guide_id','left')
            ->where($where)->count();

    }

    public function carDel($where)
    {
        return $this->where($where)->setField('is_display',1);
    }
}